/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ifAssociados.java
 *
 * Created on 29/06/2010, 01:24:54
 */
package asfabdesk.apresentacao;

import asfabdesk.dominio.Associado;
import asfabdesk.dominio.CategoriaVinculo;
import asfabdesk.dominio.CidadeUf;
import asfabdesk.dominio.Convenio;
import asfabdesk.dominio.ConvenioPorAssociado;
import asfabdesk.dominio.Data;
import asfabdesk.dominio.Dependente;
import asfabdesk.dominio.Observacao;
import asfabdesk.dominio.Secretaria;
import asfabdesk.util.Util;
import asfabdesk.presistencia.DAO;
import asfabdesk.util.RelatorioUtil;
import java.awt.Color;
import java.awt.Dimension;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;
import javax.swing.event.InternalFrameEvent;
import javax.swing.event.InternalFrameListener;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Mathias
 */
public class TelaAssociadoEdt extends javax.swing.JInternalFrame {

    public Associado associado = new Associado();
    public File file;
    String caminho = TelaLogin.caminho_img;

    /** Creates new form ifAssociados */
    public TelaAssociadoEdt(Associado associado) throws SQLException {
        initComponents();
        this.associado = associado;
        configurarTelaEdt();
    }

    public TelaAssociadoEdt() throws SQLException {
        initComponents();
        configurarTela();
    }

    private void configurarTelaEdt() throws SQLException {
        setTitle(associado.getNome() + " | " + String.valueOf(associado.getRol()));        
        configurarComboSecretarias();
        configurarComboCatVinculo();
        configurarComboCidade();
        configurarComboConvenios();
        povoarCampos();
        atualizarTabelaObservacao();
        atualizarTabelaConvenios();
        atualizarTabelaDependente();
        configurarParaCadastroSalvo();
    }

    public void configurarTela() throws SQLException {
        txtRol.setText(String.valueOf(setarRol()));
        configurarComboSecretarias();
        configurarComboCatVinculo();
        configurarComboCidade();
        configurarBotoesCadastroNovo();
        configurarComboConvenios();
    }

    public void abrirIFrame(JInternalFrame janela) {
        for (JInternalFrame j : TelaPrincipal.desktop.getAllFrames()) {
            if (janela.getClass() == j.getClass()) {
                j.moveToFront();
                return;
            }
        }
        TelaPrincipal.desktop.add(janela);
        janela.setVisible(true);
    }

    public Long setarRol(){
        Long rol = new DAO().localizar(Associado.class, "MAXROL");
        rol = rol + 1;
        System.out.println("ROL"+rol);
        return rol;
    }

    public void configurarBotoesCadastroNovo() {
        btnEditar.setEnabled(false);
        btnImprimir.setEnabled(false);
        btnAtivaInativa.setEnabled(false);
        btnAdicionarObs.setEnabled(false);
        btnEditarObs.setEnabled(false);
        btnExcluirObs.setEnabled(false);
        btnNovoDependente.setEnabled(false);
        btnFoto.setEnabled(false);
    }

    public void configurarParaCadastroSalvo() {
        Class classpath = new RelatorioUtil().getClass();
        URL url1 = classpath.getResource("/asfabdesk/apresentacao/resources/padlock_open_32x32.png");
        URL url2 = classpath.getResource("/asfabdesk/apresentacao/resources/linedpaperlock32.png");
        btnEditar.setEnabled(true);
        btnImprimir.setEnabled(true);
        btnAtivaInativa.setEnabled(true);
        btnAdicionarObs.setEnabled(true);
        btnContratarConvenio.setEnabled(true);
        btnFoto.setEnabled(true);
        btnNovoDependente.setEnabled(true);
        if (associado.isAtivo()) {
            txtSituacao.setText("Ativo");
            btnAtivaInativa.setText("Inativar");
            ImageIcon img = new ImageIcon(url1);
            btnAtivaInativa.setIcon(img);
        } else {
            txtSituacao.setText("Inativo");
            btnAtivaInativa.setText("Ativar");
            ImageIcon img = new ImageIcon(url2);
            btnAtivaInativa.setIcon(img);
        }
        setTitle(associado.getNome() + " | " + String.valueOf(associado.getRol()));
    }

    public void ativaInativa() {
        if (associado.isAtivo()) {
            int resposta = JOptionPane.showConfirmDialog(null, "Realmente deseja Inativar o Associado:" + associado.getNome(), "Inativar ?", 0);
            if (resposta == 0) {
                try {
                    associado.setAtivo(false);
                    new DAO().salvar(associado);
                    JOptionPane.showMessageDialog(null, "Associado:" + associado.getNome() + " foi INATIVADO", "Inativado", 1);
                    configurarParaCadastroSalvo();
                } catch (Exception ex) {
                    ex.printStackTrace();
                    JOptionPane.showMessageDialog(null, "Ops, houve um erro na Inativação do Associado", "Ops", 0);
                }
            }

        } else {
            int resposta = JOptionPane.showConfirmDialog(null, "Realmente deseja Ativar o Associado:" + associado.getNome(), "Ativar ?", 0);
            if (resposta == 0) {
                try {
                    associado.setAtivo(true);
                    new DAO().salvar(associado);
                    JOptionPane.showMessageDialog(null, "Associado:" + associado.getNome() + " foi ATIVADO", "Ativado", 1);
                    configurarParaCadastroSalvo();
                } catch (Exception ex) {
                    ex.printStackTrace();
                    JOptionPane.showMessageDialog(null, "Ops, houve um erro na Ativação do Associado", "Ops", 0);
                }
            }
        }
    }

    public void salvarAssociado() {
        String msgSucessoEdt = "Registro Alterado com Sucesso!";
        String msgSucessoCad = "Associado Cadastrado com Sucesso!";
        String msgErroEdt = "Ops, houve um erro durante a alteração do Registro.";
        String msgErroCad = "Ops, houve um erro durante o cadastro do Associado.";
        String sucesso;
        String erro;
        if (verificarCampos()) {
            if (verificarUniques()) {
                povoarAssociado();
                if (associado.getId() > 0) {
                    sucesso = msgSucessoEdt;
                    erro = msgErroEdt;
                } else {
                    sucesso = msgSucessoCad;
                    erro = msgErroCad;
                }
                try {
                    associado = new DAO().salvar(associado);
                    JOptionPane.showMessageDialog(null, sucesso, "Sucesso", 1);
                    configurarParaCadastroSalvo();

                } catch (Exception e) {
                    JOptionPane.showMessageDialog(null, erro, "Erro", 0);
                    e.printStackTrace();
                }
            }
        }
    }

    public boolean verificarCampos() {
        boolean retorno = true;
        StringBuffer campos = new StringBuffer();
        String campo;


        if (txtRol.getText().equals("")) {
            campo = "(ROL) ";
            campos.append(campo);
            retorno = false;
        }
        if (txtDataFiliacao.getText().equals("  /  /    ")) {
            campo = " (Data de Filiação) ";
            campos.append(campo);
            retorno = false;
        }
        if (txtNome.getText().equals("")) {
            campo = " (Nome) ";
            campos.append(campo);
            retorno = false;
        }
        if (comboSexo.getSelectedItem().toString().equals("")) {
            campo = " (Sexo) ";
            campos.append(campo);
            retorno = false;
        }
        if (txtNascimento.getText().equals("  /  /    ")) {
            campo = " (Data de Nascimento) ";
            campos.append(campo);
            retorno = false;
        }
        if (txtIdentidade.getText().equals("")) {
            campo = " (Identidade) ";
            campos.append(campo);
            retorno = false;
        }
        if (txtCpf.getText().equals("   .   .   -  ")) {
            campo = " (CPF) ";
            campos.append(campo);
            retorno = false;
        }
        if (txtNomeMae.getText().equals("")) {
            campo = " (Nome da Mãe) ";
            campos.append(campo);
            retorno = false;
        }
        if (txtMatricula.getText().equals("")) {
            campo = " (Matrícula) ";
            campos.append(campo);
            retorno = false;
        }
        if (comboCategoriaVinculo.getSelectedItem().toString().equals("")) {
            campo = " (Categoria do Vínculo) ";
            campos.append(campo);
            retorno = false;
        }

        if (retorno == false) {
            JOptionPane.showMessageDialog(null, "Ops, você não preencheu o(s) seguinte(s) campo(s) obrigatório(s): " + '\n' + campos, "Campos Obrigatórios.", 2);
        }
        return retorno;
    }

    public boolean verificarUniques() {
        StringBuffer campos = new StringBuffer();
        String string = "";
        boolean retorno = true;

        if (new DAO().localizar(Associado.class, "AssociadoPorRolEdt", Long.parseLong(txtRol.getText()), associado.getId()) != null) {
            string = " (Rol= " + txtRol.getText() + ") ";
            campos.append(string);
            retorno = false;
        }
        if (new DAO().localizar(Associado.class, "AssociadoPorCpfEdt", txtCpf.getText(), associado.getId()) != null) {
            string = " (CPF= " + txtCpf.getText() + ") ";
            campos.append(string);
            retorno = false;
        }
        if (new DAO().localizar(Associado.class, "AssociadoPorIdentidadeEdt", txtIdentidade.getText(), associado.getId()) != null) {
            string = " (Identidade= " + txtIdentidade.getText() + ") ";
            campos.append(string);
            retorno = false;
        }
        if (new DAO().localizar(Associado.class, "AssociadoPorMatriculaEdt", txtMatricula.getText(), associado.getId()) != null) {
            string = " (Matricula PMAB= " + txtMatricula.getText() + ") ";
            campos.append(string);
            retorno = false;
        }

        if (retorno == false) {
            JOptionPane.showMessageDialog(null, "Ops, você está tentando salvar campo(s) já cadastrado(s): " + '\n' + campos, "Campos Únicos.", 2);
        }
        return retorno;
    }

    public void povoarAssociado() {
        try {

            associado.setRol(Integer.parseInt(txtRol.getText()));
            associado.setUsuarioCadastrante(TelaLogin.usuario);
            //Dados Pessoais ####################################
            associado.setDataFiliacao(new Data().ConverteDataStringDate(txtDataFiliacao.getText()));
            associado.setNome(txtNome.getText().toUpperCase());
            associado.setSexo(comboSexo.getSelectedItem().toString());
            associado.setDataNasc(new Data().ConverteDataStringDate(txtNascimento.getText()));
            associado.setNacionalidade(txtNacionalidade.getText().toUpperCase());
            associado.setNaturalidade(txtNaturalidade.getText().toUpperCase());
            associado.setRg(txtIdentidade.getText());
            associado.setOrgaoExpedidor(txtOrgaoExepedidor.getText().toUpperCase());
            associado.setCpf(txtCpf.getText());
            associado.setTituloEleitor(txtTitulo.getText());
            associado.setZonaEleitoral(txtZona.getText());
            associado.setSecaoEleitoral(txtSecao.getText());
            associado.setNomeMae(txtNomeMae.getText().toUpperCase());
            associado.setNomePai(txtNomePai.getText().toUpperCase());
            //Contatos & Endereço #######################################
            associado.setLogradouro(txtLogradouro.getText().toUpperCase());
            associado.setNumeroEnd(txtNumero.getText());
            associado.setBairro(txtBairro.getText().toUpperCase());
            associado.setComplemento(txtComplemento.getText());
            CidadeUf cidade = new CidadeUf();
            if (comboCidade.getSelectedItem() != null) {
                cidade = (new DAO().localizar(CidadeUf.class, "RecuperarCidadeUf", comboUF.getSelectedItem().toString(), comboCidade.getSelectedItem().toString()));
                associado.setCidadeUf(cidade);
            }
            associado.setCep(txtCep.getText());
            associado.setTel1(txtTelefone1.getText());
            associado.setTel2(txtTelefone2.getText());
            associado.setCel1(txtCelular1.getText());
            associado.setCel2(txtCelular2.getText());
            associado.setEmail(txtEmail.getText().toLowerCase());
            //Vínculo PMAB ###################################
            associado.setMatricula(txtMatricula.getText());
            try {
                associado.setDataAdmissaoPMAB(new Data().ConverteDataStringDate(txtDataAdmissao.getText()));
            } catch (Exception e) {
                System.out.println("Setando data admissão em Branco");
            }
            CategoriaVinculo categoria = new CategoriaVinculo();
            categoria = (new DAO().localizar(CategoriaVinculo.class, "CategoriaVinculoPorNome", comboCategoriaVinculo.getSelectedItem().toString()));
            associado.setCategoriaVinculo(categoria);
            associado.setFuncao(txtFuncao.getText().toUpperCase());
            associado.setCargo(txtCargo.getText().toUpperCase());
            associado.setLotacao(txtLotacao.getText().toUpperCase());
            Secretaria secretaria = new Secretaria();
            secretaria = (new DAO().localizar(Secretaria.class, "SecretariaPorNome", comboSecretaria.getSelectedItem().toString()));
            associado.setSecretaria(secretaria);
            if (comboCargoComissionado.getSelectedIndex() == 0) {
                associado.setCargoComissionado(false);
            } else {
                associado.setCargoComissionado(true);
            }
            associado.setLocalizacaoFisica(txtLocFisica.getText());

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void povoarCampos() {
        try {
            carregarFotos();
            txtRol.setText(String.valueOf(associado.getRol()));
            txtLocFisica.setText(associado.getLocalizacaoFisica());
            //Dados Pessoais ####################################
            txtDataFiliacao.setText(new Data().ConverteDataDateStringBra(associado.getDataFiliacao()));
            txtNome.setText(associado.getNome());
            comboSexo.setSelectedItem(associado.getSexo());
            txtNascimento.setText(new Data().ConverteDataDateStringBra(associado.getDataNasc()));
            txtNacionalidade.setText(associado.getNacionalidade());
            txtNaturalidade.setText(associado.getNaturalidade());
            txtIdentidade.setText(associado.getRg());
            txtOrgaoExepedidor.setText(associado.getOrgaoExpedidor());
            txtCpf.setText(associado.getCpf());
            txtTitulo.setText(associado.getTituloEleitor());
            txtZona.setText(associado.getZonaEleitoral());
            txtSecao.setText(associado.getSecaoEleitoral());
            txtNomeMae.setText(associado.getNomeMae());
            txtNomePai.setText(associado.getNomePai());
            //Contatos & Endereço #######################################
            txtLogradouro.setText(associado.getLogradouro());
            txtNumero.setText(associado.getNumeroEnd());
            txtBairro.setText(associado.getBairro());
            try {
                comboUF.setSelectedItem(associado.getCidadeUf().getUf());
                comboCidade.setSelectedItem(associado.getCidadeUf().getCidade());
            } catch (Exception e) {
                System.out.println("Povoando Cidade e UF em Branco");
            }
            txtCep.setText(associado.getCep());
            txtTelefone1.setText(associado.getTel1());
            txtTelefone2.setText(associado.getTel2());
            txtCelular1.setText(associado.getCel1());
            txtCelular2.setText(associado.getTel2());
            txtEmail.setText(associado.getEmail());
            //Vínculo PMAB ###################################
            txtMatricula.setText(associado.getMatricula());
            try {
                txtDataAdmissao.setText(new Data().ConverteDataDateStringBra(associado.getDataAdmissaoPMAB()));
            } catch (Exception e) {
                System.out.println("Povoando data admissão em Branco");
            }
            comboCategoriaVinculo.setSelectedItem(associado.getCategoriaVinculo().getDescricao());
            txtFuncao.setText(associado.getFuncao());
            txtCargo.setText(associado.getCargo());
            txtLotacao.setText(associado.getLotacao());
            comboSecretaria.setSelectedItem(associado.getSecretaria().getDescricao());
            if (associado.isCargoComissionado()) {
                comboCargoComissionado.setSelectedIndex(1);
            } else {
                comboCargoComissionado.setSelectedIndex(0);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void limparCampos() {
        txtRol.setText("");
        txtSituacao.setText("");
        txtDataFiliacao.setText("");
        txtNome.setText("");
        txtNascimento.setText("");
        txtNacionalidade.setText("");
        txtNaturalidade.setText("");
        txtIdentidade.setText("");
        txtOrgaoExepedidor.setText("");
        txtCpf.setText("");
        txtTitulo.setText("");
        txtZona.setText("");
        txtSecao.setText("");
        txtNomeMae.setText("");
        txtNomePai.setText("");
        txtLogradouro.setText("");
        txtNumero.setText("");
        txtBairro.setText("");
        txtComplemento.setText("");
        txtCep.setText("");
        txtTelefone1.setText("");
        txtTelefone2.setText("");
        txtCelular1.setText("");
        txtCelular2.setText("");
        txtEmail.setText("");
        txtMatricula.setText("");
        txtDataAdmissao.setText("");
        comboCategoriaVinculo.setSelectedItem("");
        txtFuncao.setText("");
        txtCargo.setText("");
        txtLotacao.setText("");
        comboSecretaria.setSelectedItem("");
        comboCargoComissionado.setSelectedIndex(0);
        txtLocFisica.setText("");
        comboSexo.setSelectedItem("");
    }

    public boolean adicionarObservacao() {
        if (txtObservacao.getText().length() < 10) {
            JOptionPane.showMessageDialog(null, "Ops, a observação não pode ter menos de 10 caractéres! ", "Atenção.", 2);
            return false;
        }
        Date data = new Date();
        String dataString = (String) new Data().ConverteDataHoraDateStringBra(data);
        try {
            data = new Data().ConverteDataHoraStringDate(dataString);
        } catch (ParseException ex) {
            Logger.getLogger(TelaAssociadoEdt.class.getName()).log(Level.SEVERE, null, ex);
        }
        Observacao obs = new Observacao();
        obs.setTextoObs(txtObservacao.getText());
        obs.setAssociado(associado);
        obs.setTipoObs("associado");
        obs.setDataRegistro(data);
        obs.setTextoObs(txtObservacao.getText());
        obs.setUsuarioCadastrante(TelaLogin.usuario);
        try {
            new DAO().salvar(obs);
            JOptionPane.showMessageDialog(null, "Observação adicionada com sucesso! ", "Atenção.", 1);
            txtObservacao.setText("");
            atualizarTabelaObservacao();
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            JOptionPane.showMessageDialog(null, "Ops, ocorreu um erro no cadastro desta observação! ", "Atenção.", 0);
            return false;
        }

    }

    public void configurarComboSecretarias() throws SQLException {
        java.util.List secretarias = (new DAO()).listar(Secretaria.class);
        for (int i = 0; i < secretarias.size(); i++) {
            String descricao = ((Secretaria) secretarias.get(i)).getDescricao();
            comboSecretaria.addItem(descricao);
        }
        comboSecretaria.addItem("");
        comboSecretaria.setSelectedItem("");
    }

    public void configurarComboCatVinculo() throws SQLException {
        java.util.List vinculos = (new DAO()).listar(CategoriaVinculo.class);
        for (int i = 0; i < vinculos.size(); i++) {
            String descricao = ((CategoriaVinculo) vinculos.get(i)).getDescricao();
            comboCategoriaVinculo.addItem(descricao);
        }
        comboCategoriaVinculo.addItem("");
        comboCategoriaVinculo.setSelectedItem("");
    }

    public void configurarComboCidade() throws SQLException {
        comboCidade.removeAllItems();
        java.util.List cidades = (new DAO().listar(CidadeUf.class, "CidadePorUf", comboUF.getSelectedItem().toString()));
        for (int i = 0; i < cidades.size(); i++) {
            String cidade = ((CidadeUf) cidades.get(i)).getCidade();
            comboCidade.addItem(cidade);
        }
        comboCidade.addItem("");
        comboCidade.setSelectedItem("");
    }

    public void configurarComboConvenios() throws SQLException {
        comboConvenios.removeAllItems();
        java.util.List convenios = (new DAO().listar(Convenio.class, "ConveniosPorStatus", true));
        for (int i = 0; i < convenios.size(); i++) {
            String conv = ((Convenio) convenios.get(i)).getNome();
            comboConvenios.addItem(conv);
        }
        comboConvenios.addItem("");
        comboConvenios.setSelectedItem("");
    }

    private void atualizarTabelaObservacao() {
        try {
            List<Observacao> observacoes = new DAO().listar(Observacao.class, "ObservacoesPorAssociado", associado);
            tabelaObservacao.setModel(new ModeloObservacao(observacoes));
            btnEditarObs.setEnabled(false);
            btnExcluirObs.setEnabled(false);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    private class ModeloObservacao extends DefaultTableModel {

        private List<Observacao> lista;
        private String[] campos = new String[]{"Id", "Data", "Observação", "Usuário"};

        public ModeloObservacao(List<Observacao> list) {
            lista = list;
        }

        public ModeloObservacao() {
        }

        public Observacao getObservacao(int index) {
            return lista.get(index);
        }

        @Override
        public boolean isCellEditable(int row, int column) {
            return false;
        }

        @Override
        public Object getValueAt(int row, int column) {
            Observacao observacao = lista.get(row);


            switch (column) {
                case 0:
                    return observacao.getId();

                case 1:
                    return observacao.getDataRegistro();

                case 2:
                    return observacao.getTextoObs();

                case 3:
                    return observacao.getUsuarioCadastrante().getNome();

                default:
                    return null;
            }
        }

        @Override
        public int getRowCount() {
            return lista == null ? 0 : lista.size();
        }

        @Override
        public int getColumnCount() {
            return campos.length;
        }

        @Override
        public String getColumnName(int column) {
            return campos[column];
        }
    }

    public void selecionarObservacao() {
        btnEditarObs.setEnabled(true);
        btnExcluirObs.setEnabled(true);
        Observacao observacao = (((ModeloObservacao) tabelaObservacao.getModel()).getObservacao(tabelaObservacao.getSelectedRow()));
        txtObservacao.setText(observacao.getTextoObs());
        txtObservacao.setEditable(false);
        txtObservacao.setBackground(Color.lightGray);
        btnAdicionarObs.setText("Novo");
    }

    public void ExcluirObservacao() {
        Observacao observacao = (((ModeloObservacao) tabelaObservacao.getModel()).getObservacao(tabelaObservacao.getSelectedRow()));
        int resposta = JOptionPane.showConfirmDialog(null, "Realmente deseja excluir esta observação ?", "Excluir Obs?", 0);
        if (resposta == 0) {
            try {
                new DAO().remover(observacao);
                atualizarTabelaObservacao();
                JOptionPane.showMessageDialog(null, "A Observação foi excluida com Suceso!.", "Excluida", 1);
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(null, "Ops, houve um erro durante a exclusão desta Observação.", "Erro", 0);
                ex.printStackTrace();
            }
        }
    }

    public boolean EditarObservacao() {
        Observacao obs = (((ModeloObservacao) tabelaObservacao.getModel()).getObservacao(tabelaObservacao.getSelectedRow()));
        if (txtObservacao.getText().length() < 10) {
            JOptionPane.showMessageDialog(null, "Ops, a observação não pode ter menos de 10 caractéres! ", "Atenção.", 2);
            return false;
        }
        Date data = new Date();
        String dataString = (String) new Data().ConverteDataHoraDateStringBra(data);
        try {
            data = new Data().ConverteDataHoraStringDate(dataString);
        } catch (ParseException ex) {
            Logger.getLogger(TelaAssociadoEdt.class.getName()).log(Level.SEVERE, null, ex);
        }
        obs.setDataRegistro(data);
        obs.setTextoObs(txtObservacao.getText());
        // lembrar de setar o usuário cadastrante
        int resposta = JOptionPane.showConfirmDialog(null, "Realmente deseja alterar esta observação ?", "Editar Obs?", 0);
        if (resposta == 0) {
            try {
                new DAO().salvar(obs);
                atualizarTabelaObservacao();
                JOptionPane.showMessageDialog(null, "A Observação foi alterada com Suceso!.", "Excluida", 1);
                txtObservacao.setText("");
                btnAdicionarObs.setText("Salvar");
                return true;
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(null, "Ops, houve um erro durante a alteração desta Observação.", "Erro", 0);
                ex.printStackTrace();
            }
        }
        return false;
    }

    public void AcoesBtnAdicionarObservacao() {
        if (btnAdicionarObs.getText().equals("Adicionar")) {
            adicionarObservacao();
        } else if (btnAdicionarObs.getText().equals("Novo")) {
            atualizarTabelaObservacao();
            txtObservacao.setText("");
            txtObservacao.setEditable(true);
            txtObservacao.setBackground(Color.white);
            btnAdicionarObs.setText("Adicionar");
        } else if (btnAdicionarObs.getText().equals("Alterar")) {
            EditarObservacao();
        }
    }

    private void chamarAdesaoConvenio() {
        ConvenioPorAssociado conv = new ConvenioPorAssociado();
        Convenio convenio = new DAO().localizar(Convenio.class, "ConvenioPorNome", comboConvenios.getSelectedItem().toString());
        conv.setConvenio(convenio);
        conv.setAssociado(associado);
        Date data = new Date();
        conv.setDataRegistro(data);
        conv.setUsuarioCadastrante(TelaLogin.usuario);
        TelaAdesaoConvenio ac = new TelaAdesaoConvenio(conv);
        FrameListenerConvenios fl = new FrameListenerConvenios();
        ac.addInternalFrameListener(fl);
        abrirIFrame(ac);
    }

    private class FrameListenerConvenios implements InternalFrameListener {

        public void internalFrameClosed(InternalFrameEvent e) {
            atualizarTabelaConvenios();
        }

        public void internalFrameOpened(InternalFrameEvent e) {
//            throw new UnsupportedOperationException("Not supported yet.");
        }

        public void internalFrameClosing(InternalFrameEvent e) {
//            throw new UnsupportedOperationException("Not supported yet.");
        }

        public void internalFrameIconified(InternalFrameEvent e) {
//            throw new UnsupportedOperationException("Not supported yet.");
        }

        public void internalFrameDeiconified(InternalFrameEvent e) {
//            throw new UnsupportedOperationException("Not supported yet.");
        }

        public void internalFrameActivated(InternalFrameEvent e) {
//            throw new UnsupportedOperationException("Not supported yet.");
        }

        public void internalFrameDeactivated(InternalFrameEvent e) {
//            throw new UnsupportedOperationException("Not supported yet.");
        }
    }

    public void atualizarTabelaConvenios() {
        try {
            List<ConvenioPorAssociado> convPessoa = new DAO().listar(ConvenioPorAssociado.class, "ConveniosPorAssociado", associado);
            TabelaConveniosContratados.setModel(new ModeloConvenioPorAssociado(convPessoa));

        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    private class ModeloConvenioPorAssociado extends DefaultTableModel {

        private List<ConvenioPorAssociado> lista;
        private String[] campos = new String[]{"Convênio", "Empresa", "Inicio", "Usuário"};

        public ModeloConvenioPorAssociado(List<ConvenioPorAssociado> list) {
            lista = list;
        }

        public ModeloConvenioPorAssociado() {
        }

        public ConvenioPorAssociado getConvenio(int index) {
            return lista.get(index);
        }

        @Override
        public boolean isCellEditable(int row, int column) {
            return false;
        }

        @Override
        public Object getValueAt(int row, int column) {
            ConvenioPorAssociado convenio = lista.get(row);


            switch (column) {
                case 0:
                    return convenio.getConvenio().getNome();

                case 1:
                    return convenio.getConvenio().getEmpresa().getNomeFantasia();
                case 2:
                    return convenio.getDataRegistro();

                case 3:
                    return convenio.getUsuarioCadastrante().getNome();

                default:
                    return null;
            }
        }

        @Override
        public int getRowCount() {
            return lista == null ? 0 : lista.size();
        }

        @Override
        public int getColumnCount() {
            return campos.length;
        }

        @Override
        public String getColumnName(int column) {
            return campos[column];
        }
    }

    private void atualizarTabelaDependente() {
        try {
            List<Dependente> dep = new DAO().listar(Dependente.class, "DependentesPorAssociado", associado);
            tabelaDependentes.setModel(new ModeloDependente(dep));
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    public void abrirDependente() throws SQLException {
        Dependente dependente = (((ModeloDependente) tabelaDependentes.getModel()).getDependente(tabelaDependentes.getSelectedRow()));
        if (dependente != null) {
            abrirIFrame(new TelaDependente(associado, dependente));
        }
    }

    private class ModeloDependente extends DefaultTableModel {

        private List<Dependente> lista;
        private String[] campos = new String[]{"RolDep", "Nome", "Nascimento", "Cadastrante", "Ativo"};

        public ModeloDependente(List<Dependente> list) {
            lista = list;
        }

        public ModeloDependente() {
        }

        public Dependente getDependente(int index) {
            return lista.get(index);
        }

        @Override
        public boolean isCellEditable(int row, int column) {
            return false;
        }

        @Override
        public Object getValueAt(int row, int column) {
            Dependente dependente = lista.get(row);
            switch (column) {
                case 0:
                    return dependente.getRolDependente();

                case 1:
                    return dependente.getNome();

                case 2:
                    return new Data().ConverteDataDateStringBra(dependente.getDataNasc());

                case 3:
                    return dependente.getUsuarioCadastrante().getNome();

                case 4:
                    return dependente.isAtivo();

                default:
                    return null;
            }
        }

        @Override
        public int getRowCount() {
            return lista == null ? 0 : lista.size();
        }

        @Override
        public int getColumnCount() {
            return campos.length;
        }

        @Override
        public String getColumnName(int column) {
            return campos[column];
        }

        @Override
        public Class<?> getColumnClass(int column) {
            if (column == 4) {
                return Boolean.class;
            }
            return super.getColumnClass(column);
        }
    }

    public void chamarTelaDependente() {
        try {
            abrirIFrame(new TelaDependente(associado));
        } catch (SQLException ex) {
            Logger.getLogger(TelaAssociadoEdt.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void salvarFoto(String path) throws IOException {
        File fileOriginal = new File(path);
        File fileTratado = null;
        fileTratado = new File(Util.salvarArquivo(caminho, fileOriginal, null));
        byte[] img = Util.getBytesFromFile(fileTratado);

        try {
            associado.setFoto(img);
            new DAO().salvar(associado);
            JOptionPane.showMessageDialog(null, "Nova foto salva com Sucesso.", "Sucesso", 1);
        } catch (Exception ex) {
            ex.printStackTrace();
            System.out.println("Erro ao Salvar a foto heim: " + ex.getMessage());
        }
        fileOriginal.deleteOnExit();
        fileTratado.deleteOnExit();

    }

    public void carregarFotos() throws FileNotFoundException, IOException {

        try {
            File img = Util.getFileFromBytes(associado.getFoto(), String.valueOf(associado.getRol()));
            String realPath = Util.salvarArquivo(caminho, img, new Dimension(160, 213));
            ImageIcon foto = new ImageIcon(realPath);
            lblFoto.setIcon(foto);
            file = new File(realPath);
            file.deleteOnExit();
            img.deleteOnExit();
        } catch (Exception ex) {
            System.out.println("Falha no Método carregarFotos(): " + ex.getMessage());
        }

    }

    public void procurarFoto() {
        TelaBuscarFoto bf = new TelaBuscarFoto();
        FrameListenerProcuraFoto fl = new FrameListenerProcuraFoto();
        bf.addInternalFrameListener(fl);
        abrirIFrame(bf);
    }

    private class FrameListenerProcuraFoto implements InternalFrameListener {

        public void internalFrameClosed(InternalFrameEvent e) {
            File foto = TelaBuscarFoto.fc.getSelectedFile();
            if (foto != null) {
                try {
                    salvarFoto(foto.getAbsolutePath());
                    System.out.println("passou por aqui 1");
                    carregarFotos();
                    System.out.println("passou por aqui 2");
                } catch (Exception ex) {
                    System.out.println("ERRO AO CARREGAR A FOTO: " + ex.getMessage());
                }
            }

        }

        public void internalFrameOpened(InternalFrameEvent e) {
//            throw new UnsupportedOperationException("Not supported yet.");
        }

        public void internalFrameClosing(InternalFrameEvent e) {
//            throw new UnsupportedOperationException("Not supported yet.");
        }

        public void internalFrameIconified(InternalFrameEvent e) {
//            throw new UnsupportedOperationException("Not supported yet.");
        }

        public void internalFrameDeiconified(InternalFrameEvent e) {
//            throw new UnsupportedOperationException("Not supported yet.");
        }

        public void internalFrameActivated(InternalFrameEvent e) {
//            throw new UnsupportedOperationException("Not supported yet.");
        }

        public void internalFrameDeactivated(InternalFrameEvent e) {
//            throw new UnsupportedOperationException("Not supported yet.");
        }
    }

    public void imprimir() {

        List<HashMap<String, String>> lista = new ArrayList();
        HashMap<String, String> mapa = new HashMap();
        lista.add(mapa);
        Map parametros = new HashMap();
        if (associado.getRol() < 10) {
            parametros.put("rol", "000" + String.valueOf(associado.getRol()));
        } else if (associado.getRol() < 100) {
            parametros.put("rol", "00" + String.valueOf(associado.getRol()));
        } else if (associado.getRol() < 1000) {
            parametros.put("rol", "0" + String.valueOf(associado.getRol()));
        } else if (associado.getRol() > 999) {
            parametros.put("rol", String.valueOf(associado.getRol()));
        }
        parametros.put("nome", associado.getNome());
        parametros.put("nascimento", new Data().ConverteDataDateStringBra(associado.getDataNasc()));
        parametros.put("naturalidade", associado.getNaturalidade());
        parametros.put("nacionalidade", associado.getNacionalidade());
        parametros.put("naturalidade", associado.getNaturalidade());
        parametros.put("rg", associado.getRg());
        parametros.put("orgao", associado.getOrgaoExpedidor());
        parametros.put("cpf", associado.getCpf());
        parametros.put("titulo", associado.getNaturalidade());
        parametros.put("zona", associado.getNaturalidade());
        parametros.put("secao", associado.getNaturalidade());
        parametros.put("nome_mae", associado.getNomePai()); // fiz uma inversão para depois acertar
        parametros.put("nome_pai", associado.getNomeMae()); // fiz uma inversão para depois acertar
        parametros.put("logradouro", associado.getLogradouro());
        parametros.put("numero", associado.getNumeroEnd());
        parametros.put("complemento", associado.getComplemento());
        parametros.put("bairro", associado.getBairro());
        parametros.put("cep", associado.getCep());
        parametros.put("tel1", associado.getTel1());
        parametros.put("tel2", associado.getTel2());
        parametros.put("cel1", associado.getCel1());
        parametros.put("cel2", associado.getCel2());
        parametros.put("email", associado.getEmail());
        parametros.put("matricula", associado.getMatricula());
        parametros.put("categoria_vinculo", associado.getCategoriaVinculo().getDescricao());
        parametros.put("secretaria", associado.getSecretaria().getDescricao());
        parametros.put("cargo", associado.getCargo());
        parametros.put("funcao", associado.getFuncao());
        parametros.put("lotacao", associado.getLotacao());
        parametros.put("sexo", associado.getSexo());
        if (associado.getCidadeUf() != null) {
            parametros.put("cidade", associado.getCidadeUf().getCidade());
            parametros.put("uf", associado.getCidadeUf().getUf());
        } else {
            parametros.put("cidade", "");
            parametros.put("uf", "");
        }
        if (associado.getDataAdmissaoPMAB() != null) {
            parametros.put("data_admissao", new Data().ConverteDataDateStringBra(associado.getDataAdmissaoPMAB()));
        } else {
            parametros.put("data_admissao", "");
        }

        Class classpath = new RelatorioUtil().getClass();
        URL url = classpath.getResource("/asfabdesk/apresentacao/resources/busyicons/fundoFichaAssociado.jpg");
        String fundo = url.toString();
        parametros.put("fundo", fundo);
        if (associado.getFoto() != null) {
            String foto = caminho + String.valueOf(associado.getRol() + ".jpg");
            parametros.put("foto", foto);
        }
        new RelatorioUtil().imprimir("associado", "Associado", lista, parametros);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        PainelPrincipal = new javax.swing.JPanel();
        tbDadosDoAssociado = new javax.swing.JTabbedPane();
        abDadosPessoais = new javax.swing.JPanel();
        txtNome = new javax.swing.JTextField();
        txtOrgaoExepedidor = new javax.swing.JTextField();
        txtNacionalidade = new javax.swing.JTextField();
        txtNaturalidade = new javax.swing.JTextField();
        txtIdentidade = new javax.swing.JTextField();
        txtTitulo = new javax.swing.JTextField();
        txtZona = new javax.swing.JTextField();
        txtSecao = new javax.swing.JTextField();
        txtNomeMae = new javax.swing.JTextField();
        txtNomePai = new javax.swing.JTextField();
        txtNascimento = new javax.swing.JFormattedTextField();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        txtCpf = new javax.swing.JFormattedTextField();
        jLabel40 = new javax.swing.JLabel();
        comboSexo = new javax.swing.JComboBox();
        jLabel43 = new javax.swing.JLabel();
        abEnderecoContatos = new javax.swing.JPanel();
        painelEndereco = new javax.swing.JPanel();
        txtLogradouro = new javax.swing.JTextField();
        txtNumero = new javax.swing.JTextField();
        txtBairro = new javax.swing.JTextField();
        txtComplemento = new javax.swing.JTextField();
        comboCidade = new javax.swing.JComboBox();
        comboUF = new javax.swing.JComboBox();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        txtCep = new javax.swing.JFormattedTextField();
        painelContatos = new javax.swing.JPanel();
        txtEmail = new javax.swing.JTextField();
        txtTelefone1 = new javax.swing.JFormattedTextField();
        txtTelefone2 = new javax.swing.JFormattedTextField();
        txtCelular1 = new javax.swing.JFormattedTextField();
        txtCelular2 = new javax.swing.JFormattedTextField();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        jLabel29 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        jLabel30 = new javax.swing.JLabel();
        abaVinculo = new javax.swing.JPanel();
        txtMatricula = new javax.swing.JTextField();
        txtDataAdmissao = new javax.swing.JFormattedTextField();
        txtFuncao = new javax.swing.JTextField();
        comboCategoriaVinculo = new javax.swing.JComboBox();
        comboSecretaria = new javax.swing.JComboBox();
        comboCargoComissionado = new javax.swing.JComboBox();
        txtCargo = new javax.swing.JTextField();
        txtLotacao = new javax.swing.JTextField();
        jLabel22 = new javax.swing.JLabel();
        jLabel28 = new javax.swing.JLabel();
        jLabel31 = new javax.swing.JLabel();
        jLabel32 = new javax.swing.JLabel();
        jLabel33 = new javax.swing.JLabel();
        jLabel34 = new javax.swing.JLabel();
        jLabel35 = new javax.swing.JLabel();
        jLabel36 = new javax.swing.JLabel();
        abDependentes = new javax.swing.JPanel();
        bfDependentenIferior1 = new javax.swing.JToolBar();
        jScrollPane1 = new javax.swing.JScrollPane();
        tabelaDependentes = new javax.swing.JTable();
        btnNovoDependente = new javax.swing.JButton();
        jLabel41 = new javax.swing.JLabel();
        abConvenios = new javax.swing.JPanel();
        comboConvenios = new javax.swing.JComboBox();
        jLabel2 = new javax.swing.JLabel();
        btnContratarConvenio = new javax.swing.JButton();
        scrollConveniosContratados = new javax.swing.JScrollPane();
        TabelaConveniosContratados = new javax.swing.JTable();
        jLabel37 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        abProtocolo = new javax.swing.JPanel();
        jButton5 = new javax.swing.JButton();
        jScrollPane5 = new javax.swing.JScrollPane();
        jTable4 = new javax.swing.JTable();
        jLabel38 = new javax.swing.JLabel();
        abInfo = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        txtObservacao = new javax.swing.JTextArea();
        btnAdicionarObs = new javax.swing.JButton();
        jScrollPane6 = new javax.swing.JScrollPane();
        tabelaObservacao = new javax.swing.JTable();
        btnEditarObs = new javax.swing.JButton();
        btnExcluirObs = new javax.swing.JButton();
        jLabel39 = new javax.swing.JLabel();
        abHistorico = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        jTable3 = new javax.swing.JTable();
        jLabel42 = new javax.swing.JLabel();
        pnEsquerdo = new javax.swing.JPanel();
        txtRol = new javax.swing.JTextField();
        txtSituacao = new javax.swing.JTextField();
        lblFoto = new javax.swing.JLabel();
        txtDataFiliacao = new javax.swing.JFormattedTextField();
        txtLocFisica = new javax.swing.JFormattedTextField();
        btnFoto = new javax.swing.JButton();
        bfInferior = new javax.swing.JToolBar();
        btnSalvar = new javax.swing.JButton();
        btnEditar = new javax.swing.JButton();
        btnAtivaInativa = new javax.swing.JButton();
        btnImprimir = new javax.swing.JButton();

        setClosable(true);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(asfabdesk.apresentacao.AsfabDeskApp.class).getContext().getResourceMap(TelaAssociadoEdt.class);
        setForeground(resourceMap.getColor("Form.foreground")); // NOI18N
        setIconifiable(true);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setFrameIcon(resourceMap.getIcon("Form.frameIcon")); // NOI18N
        setName("Form"); // NOI18N
        try {
            setSelected(true);
        } catch (java.beans.PropertyVetoException e1) {
            e1.printStackTrace();
        }
        setVisible(true);

        PainelPrincipal.setBackground(resourceMap.getColor("PainelPrincipal.background")); // NOI18N
        PainelPrincipal.setName("PainelPrincipal"); // NOI18N
        PainelPrincipal.setPreferredSize(new java.awt.Dimension(698, 471));
        PainelPrincipal.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        tbDadosDoAssociado.setForeground(resourceMap.getColor("tbDadosDoAssociado.foreground")); // NOI18N
        tbDadosDoAssociado.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION);
        tbDadosDoAssociado.setFont(resourceMap.getFont("tbDadosDoAssociado.font")); // NOI18N
        tbDadosDoAssociado.setName("tbDadosDoAssociado"); // NOI18N

        abDadosPessoais.setBackground(resourceMap.getColor("abDadosPessoais.background")); // NOI18N
        abDadosPessoais.setName("abDadosPessoais"); // NOI18N
        abDadosPessoais.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        txtNome.setFont(resourceMap.getFont("txtNome.font")); // NOI18N
        txtNome.setForeground(resourceMap.getColor("txtNome.foreground")); // NOI18N
        txtNome.setText(resourceMap.getString("txtNome.text")); // NOI18N
        txtNome.setName("txtNome"); // NOI18N
        abDadosPessoais.add(txtNome, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, 430, -1));

        txtOrgaoExepedidor.setFont(resourceMap.getFont("txtNomePai.font")); // NOI18N
        txtOrgaoExepedidor.setText(resourceMap.getString("txtOrgaoExepedidor.text")); // NOI18N
        txtOrgaoExepedidor.setMaximumSize(null);
        txtOrgaoExepedidor.setName("txtOrgaoExepedidor"); // NOI18N
        abDadosPessoais.add(txtOrgaoExepedidor, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 120, 90, -1));

        txtNacionalidade.setFont(resourceMap.getFont("txtNomePai.font")); // NOI18N
        txtNacionalidade.setText(resourceMap.getString("text")); // NOI18N
        txtNacionalidade.setMaximumSize(null);
        txtNacionalidade.setName(""); // NOI18N
        abDadosPessoais.add(txtNacionalidade, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 70, 160, -1));

        txtNaturalidade.setText(resourceMap.getString("text")); // NOI18N
        txtNaturalidade.setMaximumSize(null);
        abDadosPessoais.add(txtNaturalidade, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 70, 180, -1));

        txtIdentidade.setFont(resourceMap.getFont("txtIdentidade.font")); // NOI18N
        txtIdentidade.setText(resourceMap.getString("txtIdentidade.text")); // NOI18N
        txtIdentidade.setMaximumSize(null);
        txtIdentidade.setName("txtIdentidade"); // NOI18N
        abDadosPessoais.add(txtIdentidade, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 120, 90, -1));

        txtTitulo.setFont(resourceMap.getFont("txtNomePai.font")); // NOI18N
        txtTitulo.setText(resourceMap.getString("txtTitulo.text")); // NOI18N
        txtTitulo.setName("txtTitulo"); // NOI18N
        abDadosPessoais.add(txtTitulo, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 170, 90, -1));

        txtZona.setFont(resourceMap.getFont("txtNomePai.font")); // NOI18N
        txtZona.setText(resourceMap.getString("txtZona.text")); // NOI18N
        txtZona.setName("txtZona"); // NOI18N
        abDadosPessoais.add(txtZona, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 170, 50, -1));

        txtSecao.setFont(resourceMap.getFont("txtNomePai.font")); // NOI18N
        txtSecao.setText(resourceMap.getString("txtSecao.text")); // NOI18N
        txtSecao.setName("txtSecao"); // NOI18N
        abDadosPessoais.add(txtSecao, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 170, 40, -1));

        txtNomeMae.setFont(resourceMap.getFont("txtNomePai.font")); // NOI18N
        txtNomeMae.setText(resourceMap.getString("txtNomeMae.text")); // NOI18N
        txtNomeMae.setName("txtNomeMae"); // NOI18N
        abDadosPessoais.add(txtNomeMae, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 220, 485, -1));

        txtNomePai.setFont(resourceMap.getFont("txtNomePai.font")); // NOI18N
        txtNomePai.setText(resourceMap.getString("txtNomePai.text")); // NOI18N
        txtNomePai.setName("txtNomePai"); // NOI18N
        abDadosPessoais.add(txtNomePai, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 269, 485, -1));

        try {
            txtNascimento.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        txtNascimento.setText(resourceMap.getString("txtNascimento.text")); // NOI18N
        txtNascimento.setName("txtNascimento"); // NOI18N
        abDadosPessoais.add(txtNascimento, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 70, 70, -1));

        jLabel3.setFont(resourceMap.getFont("jLabel13.font")); // NOI18N
        jLabel3.setForeground(resourceMap.getColor("jLabel3.foreground")); // NOI18N
        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N
        abDadosPessoais.add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(450, 0, -1, -1));

        jLabel4.setFont(resourceMap.getFont("jLabel5.font")); // NOI18N
        jLabel4.setForeground(resourceMap.getColor("jLabel4.foreground")); // NOI18N
        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N
        abDadosPessoais.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 50, -1, -1));

        jLabel5.setFont(resourceMap.getFont("jLabel5.font")); // NOI18N
        jLabel5.setForeground(resourceMap.getColor("jLabel5.foreground")); // NOI18N
        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N
        abDadosPessoais.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 50, -1, -1));

        jLabel6.setFont(resourceMap.getFont("jLabel5.font")); // NOI18N
        jLabel6.setForeground(resourceMap.getColor("jLabel6.foreground")); // NOI18N
        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N
        abDadosPessoais.add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 50, -1, -1));

        jLabel7.setFont(resourceMap.getFont("jLabel13.font")); // NOI18N
        jLabel7.setForeground(resourceMap.getColor("jLabel7.foreground")); // NOI18N
        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N
        abDadosPessoais.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 100, -1, -1));

        jLabel8.setFont(resourceMap.getFont("jLabel13.font")); // NOI18N
        jLabel8.setForeground(resourceMap.getColor("jLabel8.foreground")); // NOI18N
        jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
        jLabel8.setName("jLabel8"); // NOI18N
        abDadosPessoais.add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 100, -1, -1));

        jLabel9.setFont(resourceMap.getFont("jLabel13.font")); // NOI18N
        jLabel9.setForeground(resourceMap.getColor("jLabel9.foreground")); // NOI18N
        jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
        jLabel9.setName("jLabel9"); // NOI18N
        abDadosPessoais.add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 100, -1, -1));

        jLabel10.setFont(resourceMap.getFont("jLabel13.font")); // NOI18N
        jLabel10.setForeground(resourceMap.getColor("jLabel10.foreground")); // NOI18N
        jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
        jLabel10.setName("jLabel10"); // NOI18N
        abDadosPessoais.add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 150, -1, -1));

        jLabel11.setFont(resourceMap.getFont("jLabel13.font")); // NOI18N
        jLabel11.setForeground(resourceMap.getColor("jLabel11.foreground")); // NOI18N
        jLabel11.setName("jLabel11"); // NOI18N
        abDadosPessoais.add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 150, -1, -1));

        jLabel12.setFont(resourceMap.getFont("jLabel13.font")); // NOI18N
        jLabel12.setForeground(resourceMap.getColor("jLabel12.foreground")); // NOI18N
        jLabel12.setText(resourceMap.getString("jLabel12.text")); // NOI18N
        jLabel12.setName("jLabel12"); // NOI18N
        abDadosPessoais.add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 150, -1, -1));

        jLabel13.setFont(resourceMap.getFont("jLabel13.font")); // NOI18N
        jLabel13.setForeground(resourceMap.getColor("jLabel13.foreground")); // NOI18N
        jLabel13.setText(resourceMap.getString("jLabel13.text")); // NOI18N
        jLabel13.setName("jLabel13"); // NOI18N
        abDadosPessoais.add(jLabel13, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 200, -1, -1));

        jLabel14.setFont(resourceMap.getFont("jLabel13.font")); // NOI18N
        jLabel14.setForeground(resourceMap.getColor("jLabel14.foreground")); // NOI18N
        jLabel14.setText(resourceMap.getString("jLabel14.text")); // NOI18N
        jLabel14.setName("jLabel14"); // NOI18N
        abDadosPessoais.add(jLabel14, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 250, -1, -1));

        try {
            txtCpf.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("###.###.###-##")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        txtCpf.setName("txtCpf"); // NOI18N
        abDadosPessoais.add(txtCpf, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 120, 100, -1));

        jLabel40.setFont(resourceMap.getFont("jLabel40.font")); // NOI18N
        jLabel40.setForeground(resourceMap.getColor("jLabel40.foreground")); // NOI18N
        jLabel40.setText(resourceMap.getString("jLabel40.text")); // NOI18N
        jLabel40.setName("jLabel40"); // NOI18N
        abDadosPessoais.add(jLabel40, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 150, -1, -1));

        comboSexo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "", "F", "M" }));
        comboSexo.setName("comboSexo"); // NOI18N
        abDadosPessoais.add(comboSexo, new org.netbeans.lib.awtextra.AbsoluteConstraints(450, 20, 50, -1));

        jLabel43.setFont(resourceMap.getFont("jLabel43.font")); // NOI18N
        jLabel43.setForeground(resourceMap.getColor("jLabel43.foreground")); // NOI18N
        jLabel43.setText(resourceMap.getString("jLabel43.text")); // NOI18N
        jLabel43.setName("jLabel43"); // NOI18N
        abDadosPessoais.add(jLabel43, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 0, -1, -1));

        tbDadosDoAssociado.addTab(resourceMap.getString("abDadosPessoais.TabConstraints.tabTitle"), abDadosPessoais); // NOI18N

        abEnderecoContatos.setBackground(resourceMap.getColor("abEnderecoContatos.background")); // NOI18N
        abEnderecoContatos.setName("abEnderecoContatos"); // NOI18N
        abEnderecoContatos.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        painelEndereco.setBackground(resourceMap.getColor("painelEndereco.background")); // NOI18N
        painelEndereco.setName("painelEndereco"); // NOI18N
        painelEndereco.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        txtLogradouro.setBackground(resourceMap.getColor("txtLogradouro.background")); // NOI18N
        txtLogradouro.setFont(resourceMap.getFont("txtLogradouro.font")); // NOI18N
        txtLogradouro.setAutoscrolls(false);
        txtLogradouro.setName("txtLogradouro"); // NOI18N
        painelEndereco.add(txtLogradouro, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, 470, -1));

        txtNumero.setFont(resourceMap.getFont("txtNumero.font")); // NOI18N
        txtNumero.setName("txtNumero"); // NOI18N
        painelEndereco.add(txtNumero, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 70, 51, -1));

        txtBairro.setFont(resourceMap.getFont("txtBairro.font")); // NOI18N
        txtBairro.setName("txtBairro"); // NOI18N
        painelEndereco.add(txtBairro, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 70, 230, -1));

        txtComplemento.setFont(resourceMap.getFont("txtComplemento.font")); // NOI18N
        txtComplemento.setName("txtComplemento"); // NOI18N
        painelEndereco.add(txtComplemento, new org.netbeans.lib.awtextra.AbsoluteConstraints(310, 70, 170, 20));

        comboCidade.setBorder(null);
        painelEndereco.add(comboCidade, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 120, 220, 20));

        comboUF.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "RJ", "SP", "MG", "ES" }));
        comboUF.setBorder(null);
        comboUF.setMinimumSize(new java.awt.Dimension(49, 48));
        comboUF.setName("comboUF"); // NOI18N
        comboUF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboUFActionPerformed(evt);
            }
        });
        painelEndereco.add(comboUF, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 120, 39, 20));

        jLabel15.setFont(resourceMap.getFont("jLabel27.font")); // NOI18N
        jLabel15.setForeground(resourceMap.getColor("jLabel15.foreground")); // NOI18N
        jLabel15.setText(resourceMap.getString("jLabel15.text")); // NOI18N
        jLabel15.setName("jLabel15"); // NOI18N
        painelEndereco.add(jLabel15, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 0, -1, -1));

        jLabel16.setFont(resourceMap.getFont("jLabel27.font")); // NOI18N
        jLabel16.setForeground(resourceMap.getColor("jLabel16.foreground")); // NOI18N
        jLabel16.setText(resourceMap.getString("jLabel16.text")); // NOI18N
        jLabel16.setName("jLabel16"); // NOI18N
        painelEndereco.add(jLabel16, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 50, -1, -1));

        jLabel17.setFont(resourceMap.getFont("jLabel27.font")); // NOI18N
        jLabel17.setForeground(resourceMap.getColor("jLabel17.foreground")); // NOI18N
        jLabel17.setText(resourceMap.getString("jLabel17.text")); // NOI18N
        jLabel17.setName("jLabel17"); // NOI18N
        painelEndereco.add(jLabel17, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 50, -1, -1));

        jLabel18.setForeground(resourceMap.getColor("jLabel18.foreground")); // NOI18N
        jLabel18.setText(resourceMap.getString("jLabel18.text")); // NOI18N
        jLabel18.setName("jLabel18"); // NOI18N
        painelEndereco.add(jLabel18, new org.netbeans.lib.awtextra.AbsoluteConstraints(310, 50, 90, 10));

        jLabel19.setForeground(resourceMap.getColor("jLabel19.foreground")); // NOI18N
        jLabel19.setText(resourceMap.getString("jLabel19.text")); // NOI18N
        jLabel19.setName("jLabel19"); // NOI18N
        painelEndereco.add(jLabel19, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 100, -1, -1));

        jLabel20.setFont(resourceMap.getFont("jLabel27.font")); // NOI18N
        jLabel20.setForeground(resourceMap.getColor("jLabel20.foreground")); // NOI18N
        jLabel20.setText(resourceMap.getString("jLabel20.text")); // NOI18N
        jLabel20.setName("jLabel20"); // NOI18N
        painelEndereco.add(jLabel20, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 100, -1, -1));

        jLabel21.setFont(resourceMap.getFont("jLabel27.font")); // NOI18N
        jLabel21.setForeground(resourceMap.getColor("jLabel21.foreground")); // NOI18N
        jLabel21.setText(resourceMap.getString("jLabel21.text")); // NOI18N
        jLabel21.setName("jLabel21"); // NOI18N
        painelEndereco.add(jLabel21, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 100, -1, -1));

        try {
            txtCep.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##.###-###")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        txtCep.setName("txtCep"); // NOI18N
        painelEndereco.add(txtCep, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 120, 80, -1));

        abEnderecoContatos.add(painelEndereco, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, 480, 150));

        painelContatos.setBackground(resourceMap.getColor("painelContatos.background")); // NOI18N
        painelContatos.setName("painelContatos"); // NOI18N
        painelContatos.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        txtEmail.setFont(resourceMap.getFont("txtEmail.font")); // NOI18N
        txtEmail.setName("txtEmail"); // NOI18N
        painelContatos.add(txtEmail, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 80, 430, -1));

        try {
            txtTelefone1.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("(##) ####-####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        txtTelefone1.setName("txtTelefone1"); // NOI18N
        painelContatos.add(txtTelefone1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 30, 100, -1));

        try {
            txtTelefone2.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("(##) ####-####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        txtTelefone2.setName("txtTelefone2"); // NOI18N
        painelContatos.add(txtTelefone2, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 30, 100, -1));

        try {
            txtCelular1.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("(##) ####-####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        txtCelular1.setName("txtCelular1"); // NOI18N
        painelContatos.add(txtCelular1, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 30, 100, -1));

        try {
            txtCelular2.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("(##) ####-####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        painelContatos.add(txtCelular2, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 30, 100, -1));

        jLabel24.setFont(resourceMap.getFont("jLabel27.font")); // NOI18N
        jLabel24.setForeground(resourceMap.getColor("jLabel24.foreground")); // NOI18N
        jLabel24.setText(resourceMap.getString("jLabel24.text")); // NOI18N
        jLabel24.setName("jLabel24"); // NOI18N
        painelContatos.add(jLabel24, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, -1, -1));

        jLabel25.setFont(resourceMap.getFont("jLabel27.font")); // NOI18N
        jLabel25.setForeground(resourceMap.getColor("jLabel25.foreground")); // NOI18N
        jLabel25.setText(resourceMap.getString("jLabel25.text")); // NOI18N
        jLabel25.setName("jLabel25"); // NOI18N
        painelContatos.add(jLabel25, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 10, -1, -1));

        jLabel26.setFont(resourceMap.getFont("jLabel27.font")); // NOI18N
        jLabel26.setForeground(resourceMap.getColor("jLabel26.foreground")); // NOI18N
        jLabel26.setText(resourceMap.getString("jLabel26.text")); // NOI18N
        jLabel26.setName("jLabel26"); // NOI18N
        painelContatos.add(jLabel26, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 10, -1, -1));

        jLabel27.setFont(resourceMap.getFont("jLabel27.font")); // NOI18N
        jLabel27.setForeground(resourceMap.getColor("jLabel27.foreground")); // NOI18N
        jLabel27.setText(resourceMap.getString("jLabel27.text")); // NOI18N
        jLabel27.setName("jLabel27"); // NOI18N
        painelContatos.add(jLabel27, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 10, -1, -1));

        jLabel29.setFont(resourceMap.getFont("jLabel29.font")); // NOI18N
        jLabel29.setForeground(resourceMap.getColor("jLabel29.foreground")); // NOI18N
        jLabel29.setText(resourceMap.getString("jLabel29.text")); // NOI18N
        jLabel29.setName("jLabel29"); // NOI18N
        painelContatos.add(jLabel29, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, -1, -1));

        abEnderecoContatos.add(painelContatos, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 230, 490, 110));

        jLabel23.setFont(resourceMap.getFont("jLabel23.font")); // NOI18N
        jLabel23.setForeground(resourceMap.getColor("jLabel23.foreground")); // NOI18N
        jLabel23.setText(resourceMap.getString("jLabel23.text")); // NOI18N
        jLabel23.setName("jLabel23"); // NOI18N
        abEnderecoContatos.add(jLabel23, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 10, -1, -1));

        jLabel30.setFont(resourceMap.getFont("jLabel30.font")); // NOI18N
        jLabel30.setForeground(resourceMap.getColor("jLabel30.foreground")); // NOI18N
        jLabel30.setText(resourceMap.getString("jLabel30.text")); // NOI18N
        jLabel30.setName("jLabel30"); // NOI18N
        abEnderecoContatos.add(jLabel30, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 200, 70, -1));

        tbDadosDoAssociado.addTab(resourceMap.getString("abEnderecoContatos.TabConstraints.tabTitle"), abEnderecoContatos); // NOI18N

        abaVinculo.setBackground(resourceMap.getColor("abaVinculo.background")); // NOI18N
        abaVinculo.setName("abaVinculo"); // NOI18N
        abaVinculo.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        txtMatricula.setFont(resourceMap.getFont("txtMatricula.font")); // NOI18N
        txtMatricula.setMaximumSize(null);
        txtMatricula.setName("txtMatricula"); // NOI18N
        txtMatricula.setOpaque(false);
        abaVinculo.add(txtMatricula, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 30, 136, 20));

        try {
            txtDataAdmissao.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        txtDataAdmissao.setMaximumSize(null);
        txtDataAdmissao.setName("txtDataAdmissao"); // NOI18N
        abaVinculo.add(txtDataAdmissao, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 30, 118, -1));

        txtFuncao.setFont(resourceMap.getFont("txtFuncao.font")); // NOI18N
        txtFuncao.setName("txtFuncao"); // NOI18N
        txtFuncao.setOpaque(false);
        abaVinculo.add(txtFuncao, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 30, 200, 20));

        comboCategoriaVinculo.setBorder(null);
        comboCategoriaVinculo.setName("comboCategoriaVinculo"); // NOI18N
        comboCategoriaVinculo.setOpaque(false);
        abaVinculo.add(comboCategoriaVinculo, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 80, 170, -1));

        comboSecretaria.setBorder(null);
        comboSecretaria.setName("comboSecretaria"); // NOI18N
        abaVinculo.add(comboSecretaria, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 80, 270, -1));

        comboCargoComissionado.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "NÃO", "SIM" }));
        comboCargoComissionado.setBorder(null);
        comboCargoComissionado.setName("comboCargoComissionado"); // NOI18N
        abaVinculo.add(comboCargoComissionado, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 130, 70, 19));

        txtCargo.setFont(resourceMap.getFont("txtCargo.font")); // NOI18N
        txtCargo.setName("txtCargo"); // NOI18N
        txtCargo.setOpaque(false);
        abaVinculo.add(txtCargo, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 130, 320, 20));

        txtLotacao.setFont(resourceMap.getFont("txtLotacao.font")); // NOI18N
        txtLotacao.setName("txtLotacao"); // NOI18N
        txtLotacao.setOpaque(false);
        abaVinculo.add(txtLotacao, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 180, 260, 20));

        jLabel22.setFont(resourceMap.getFont("jLabel22.font")); // NOI18N
        jLabel22.setForeground(resourceMap.getColor("jLabel22.foreground")); // NOI18N
        jLabel22.setText(resourceMap.getString("jLabel22.text")); // NOI18N
        jLabel22.setName("jLabel22"); // NOI18N
        abaVinculo.add(jLabel22, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, -1, -1));

        jLabel28.setFont(resourceMap.getFont("jLabel22.font")); // NOI18N
        jLabel28.setForeground(resourceMap.getColor("jLabel28.foreground")); // NOI18N
        jLabel28.setText(resourceMap.getString("jLabel28.text")); // NOI18N
        jLabel28.setName("jLabel28"); // NOI18N
        abaVinculo.add(jLabel28, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 10, -1, -1));

        jLabel31.setFont(resourceMap.getFont("jLabel22.font")); // NOI18N
        jLabel31.setForeground(resourceMap.getColor("jLabel31.foreground")); // NOI18N
        jLabel31.setText(resourceMap.getString("jLabel31.text")); // NOI18N
        jLabel31.setName("jLabel31"); // NOI18N
        abaVinculo.add(jLabel31, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 10, -1, -1));

        jLabel32.setFont(resourceMap.getFont("jLabel22.font")); // NOI18N
        jLabel32.setForeground(resourceMap.getColor("jLabel32.foreground")); // NOI18N
        jLabel32.setText(resourceMap.getString("jLabel32.text")); // NOI18N
        jLabel32.setName("jLabel32"); // NOI18N
        abaVinculo.add(jLabel32, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, -1, -1));

        jLabel33.setFont(resourceMap.getFont("jLabel22.font")); // NOI18N
        jLabel33.setForeground(resourceMap.getColor("jLabel33.foreground")); // NOI18N
        jLabel33.setText(resourceMap.getString("jLabel33.text")); // NOI18N
        jLabel33.setName("jLabel33"); // NOI18N
        abaVinculo.add(jLabel33, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 60, -1, -1));

        jLabel34.setFont(resourceMap.getFont("jLabel22.font")); // NOI18N
        jLabel34.setForeground(resourceMap.getColor("jLabel34.foreground")); // NOI18N
        jLabel34.setText(resourceMap.getString("jLabel34.text")); // NOI18N
        jLabel34.setName("jLabel34"); // NOI18N
        abaVinculo.add(jLabel34, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 110, -1, -1));

        jLabel35.setFont(resourceMap.getFont("jLabel22.font")); // NOI18N
        jLabel35.setForeground(resourceMap.getColor("jLabel35.foreground")); // NOI18N
        jLabel35.setText(resourceMap.getString("jLabel35.text")); // NOI18N
        jLabel35.setName("jLabel35"); // NOI18N
        abaVinculo.add(jLabel35, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 110, -1, -1));

        jLabel36.setFont(resourceMap.getFont("jLabel22.font")); // NOI18N
        jLabel36.setForeground(resourceMap.getColor("jLabel36.foreground")); // NOI18N
        jLabel36.setText(resourceMap.getString("jLabel36.text")); // NOI18N
        jLabel36.setName("jLabel36"); // NOI18N
        abaVinculo.add(jLabel36, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 160, -1, -1));

        tbDadosDoAssociado.addTab(resourceMap.getString("abaVinculo.TabConstraints.tabTitle"), abaVinculo); // NOI18N

        abDependentes.setBackground(resourceMap.getColor("abDependentes.background")); // NOI18N
        abDependentes.setName("abDependentes"); // NOI18N

        bfDependentenIferior1.setFloatable(false);
        bfDependentenIferior1.setRollover(true);
        bfDependentenIferior1.setName("bfDependentenIferior1"); // NOI18N
        bfDependentenIferior1.setOpaque(false);

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        tabelaDependentes.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Rol Dep", "Nome", "Nascimento", "Cadastrante", "Ativo"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Object.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tabelaDependentes.setName("tabelaDependentes"); // NOI18N
        tabelaDependentes.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tabelaDependentesMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(tabelaDependentes);
        tabelaDependentes.getColumnModel().getColumn(0).setHeaderValue(resourceMap.getString("tabelaDependentes.columnModel.title0")); // NOI18N
        tabelaDependentes.getColumnModel().getColumn(1).setHeaderValue(resourceMap.getString("tabelaDependentes.columnModel.title1")); // NOI18N
        tabelaDependentes.getColumnModel().getColumn(2).setHeaderValue(resourceMap.getString("tabelaDependentes.columnModel.title2")); // NOI18N
        tabelaDependentes.getColumnModel().getColumn(3).setHeaderValue(resourceMap.getString("tabelaDependentes.columnModel.title3")); // NOI18N
        tabelaDependentes.getColumnModel().getColumn(4).setHeaderValue(resourceMap.getString("tabelaDependentes.columnModel.title4")); // NOI18N

        btnNovoDependente.setForeground(resourceMap.getColor("btnNovoDependente.foreground")); // NOI18N
        btnNovoDependente.setText(resourceMap.getString("btnNovoDependente.text")); // NOI18N
        btnNovoDependente.setName("btnNovoDependente"); // NOI18N
        btnNovoDependente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNovoDependenteActionPerformed(evt);
            }
        });

        jLabel41.setFont(resourceMap.getFont("jLabel41.font")); // NOI18N
        jLabel41.setForeground(resourceMap.getColor("jLabel41.foreground")); // NOI18N
        jLabel41.setText(resourceMap.getString("jLabel41.text")); // NOI18N
        jLabel41.setName("jLabel41"); // NOI18N

        javax.swing.GroupLayout abDependentesLayout = new javax.swing.GroupLayout(abDependentes);
        abDependentes.setLayout(abDependentesLayout);
        abDependentesLayout.setHorizontalGroup(
            abDependentesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(abDependentesLayout.createSequentialGroup()
                .addGroup(abDependentesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(abDependentesLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel41))
                    .addGroup(abDependentesLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 482, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(abDependentesLayout.createSequentialGroup()
                        .addGap(445, 445, 445)
                        .addComponent(bfDependentenIferior1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(abDependentesLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(btnNovoDependente)))
                .addContainerGap(13, Short.MAX_VALUE))
        );
        abDependentesLayout.setVerticalGroup(
            abDependentesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(abDependentesLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel41)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 256, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnNovoDependente)
                .addGap(103, 103, 103)
                .addComponent(bfDependentenIferior1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        tbDadosDoAssociado.addTab("Dependentes", abDependentes);

        abConvenios.setBackground(resourceMap.getColor("abConvenios.background")); // NOI18N
        abConvenios.setName("abConvenios"); // NOI18N
        abConvenios.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        comboConvenios.setName("comboConvenios"); // NOI18N
        abConvenios.add(comboConvenios, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 30, 201, -1));

        jLabel2.setForeground(resourceMap.getColor("jLabel2.foreground")); // NOI18N
        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N
        abConvenios.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 30, -1, 20));

        btnContratarConvenio.setForeground(resourceMap.getColor("btnContratarConvenio.foreground")); // NOI18N
        btnContratarConvenio.setText(resourceMap.getString("btnContratarConvenio.text")); // NOI18N
        btnContratarConvenio.setBorder(null);
        btnContratarConvenio.setName("btnContratarConvenio"); // NOI18N
        btnContratarConvenio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnContratarConvenioActionPerformed(evt);
            }
        });
        abConvenios.add(btnContratarConvenio, new org.netbeans.lib.awtextra.AbsoluteConstraints(360, 30, 61, 20));

        scrollConveniosContratados.setName("scrollConveniosContratados"); // NOI18N

        TabelaConveniosContratados.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Convênio", "Empresa", "Data Inicio", "Usuário"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Object.class, java.lang.String.class, java.lang.Object.class, java.lang.Object.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        TabelaConveniosContratados.setName("TabelaConveniosContratados"); // NOI18N
        TabelaConveniosContratados.setOpaque(false);
        TabelaConveniosContratados.setShowHorizontalLines(false);
        TabelaConveniosContratados.setShowVerticalLines(false);
        scrollConveniosContratados.setViewportView(TabelaConveniosContratados);

        abConvenios.add(scrollConveniosContratados, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 117, 480, 210));

        jLabel37.setFont(resourceMap.getFont("jLabel37.font")); // NOI18N
        jLabel37.setForeground(resourceMap.getColor("jLabel37.foreground")); // NOI18N
        jLabel37.setText(resourceMap.getString("jLabel37.text")); // NOI18N
        jLabel37.setName("jLabel37"); // NOI18N
        abConvenios.add(jLabel37, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 80, -1, -1));

        jSeparator1.setForeground(resourceMap.getColor("jSeparator1.foreground")); // NOI18N
        jSeparator1.setName("jSeparator1"); // NOI18N
        abConvenios.add(jSeparator1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 70, 480, 10));

        tbDadosDoAssociado.addTab(resourceMap.getString("abConvenios.TabConstraints.tabTitle"), abConvenios); // NOI18N

        abProtocolo.setBackground(resourceMap.getColor("abProtocolo.background")); // NOI18N
        abProtocolo.setName("abProtocolo"); // NOI18N
        abProtocolo.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jButton5.setForeground(resourceMap.getColor("jButton5.foreground")); // NOI18N
        jButton5.setText(resourceMap.getString("jButton5.text")); // NOI18N
        jButton5.setEnabled(false);
        jButton5.setName("jButton5"); // NOI18N
        abProtocolo.add(jButton5, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 300, -1, -1));

        jScrollPane5.setName("jScrollPane5"); // NOI18N

        jTable4.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "N° Processo", "Assunto", "Data Abertura", "Tipo", "Situação"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTable4.setName("jTable4"); // NOI18N
        jScrollPane5.setViewportView(jTable4);
        jTable4.getColumnModel().getColumn(0).setHeaderValue(resourceMap.getString("jTable4.columnModel.title0")); // NOI18N
        jTable4.getColumnModel().getColumn(1).setHeaderValue(resourceMap.getString("jTable4.columnModel.title1")); // NOI18N
        jTable4.getColumnModel().getColumn(2).setHeaderValue(resourceMap.getString("jTable4.columnModel.title2")); // NOI18N
        jTable4.getColumnModel().getColumn(3).setHeaderValue(resourceMap.getString("jTable4.columnModel.title3")); // NOI18N
        jTable4.getColumnModel().getColumn(4).setHeaderValue(resourceMap.getString("jTable4.columnModel.title4")); // NOI18N

        abProtocolo.add(jScrollPane5, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 42, 485, 240));

        jLabel38.setFont(resourceMap.getFont("jLabel38.font")); // NOI18N
        jLabel38.setForeground(resourceMap.getColor("jLabel38.foreground")); // NOI18N
        jLabel38.setText(resourceMap.getString("jLabel38.text")); // NOI18N
        jLabel38.setName("jLabel38"); // NOI18N
        abProtocolo.add(jLabel38, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, -1, -1));

        tbDadosDoAssociado.addTab(resourceMap.getString("abProtocolo.TabConstraints.tabTitle"), abProtocolo); // NOI18N

        abInfo.setBackground(resourceMap.getColor("abInfo.background")); // NOI18N
        abInfo.setName("abInfo"); // NOI18N
        abInfo.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jScrollPane3.setName("jScrollPane3"); // NOI18N

        txtObservacao.setColumns(20);
        txtObservacao.setFont(resourceMap.getFont("txtObservacao.font")); // NOI18N
        txtObservacao.setLineWrap(true);
        txtObservacao.setRows(5);
        txtObservacao.setBorder(null);
        txtObservacao.setName("txtObservacao"); // NOI18N
        jScrollPane3.setViewportView(txtObservacao);

        abInfo.add(jScrollPane3, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, 480, -1));

        btnAdicionarObs.setForeground(resourceMap.getColor("btnAdicionarObs.foreground")); // NOI18N
        btnAdicionarObs.setText(resourceMap.getString("btnAdicionarObs.text")); // NOI18N
        btnAdicionarObs.setName("btnAdicionarObs"); // NOI18N
        btnAdicionarObs.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAdicionarObsActionPerformed(evt);
            }
        });
        abInfo.add(btnAdicionarObs, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 130, -1, -1));

        jScrollPane6.setName("jScrollPane6"); // NOI18N

        tabelaObservacao.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Id", "Data", "Observação", "Usuário"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tabelaObservacao.setColumnSelectionAllowed(true);
        tabelaObservacao.setName("tabelaObservacao"); // NOI18N
        tabelaObservacao.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        tabelaObservacao.setUpdateSelectionOnSort(false);
        tabelaObservacao.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tabelaObservacaoMouseClicked(evt);
            }
        });
        jScrollPane6.setViewportView(tabelaObservacao);
        tabelaObservacao.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        tabelaObservacao.getColumnModel().getColumn(0).setHeaderValue(resourceMap.getString("tabelaObservacao.columnModel.title0")); // NOI18N
        tabelaObservacao.getColumnModel().getColumn(1).setHeaderValue(resourceMap.getString("tabelaObservacao.columnModel.title1")); // NOI18N
        tabelaObservacao.getColumnModel().getColumn(2).setHeaderValue(resourceMap.getString("tabelaObservacao.columnModel.title2")); // NOI18N
        tabelaObservacao.getColumnModel().getColumn(3).setHeaderValue(resourceMap.getString("tabelaObservacao.columnModel.title3")); // NOI18N

        abInfo.add(jScrollPane6, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 159, 480, 140));

        btnEditarObs.setForeground(resourceMap.getColor("btnEditarObs.foreground")); // NOI18N
        btnEditarObs.setText(resourceMap.getString("btnEditarObs.text")); // NOI18N
        btnEditarObs.setEnabled(false);
        btnEditarObs.setName("btnEditarObs"); // NOI18N
        btnEditarObs.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEditarObsActionPerformed(evt);
            }
        });
        abInfo.add(btnEditarObs, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 310, -1, -1));

        btnExcluirObs.setForeground(resourceMap.getColor("btnExcluirObs.foreground")); // NOI18N
        btnExcluirObs.setText(resourceMap.getString("btnExcluirObs.text")); // NOI18N
        btnExcluirObs.setEnabled(false);
        btnExcluirObs.setName("btnExcluirObs"); // NOI18N
        btnExcluirObs.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnExcluirObsActionPerformed(evt);
            }
        });
        abInfo.add(btnExcluirObs, new org.netbeans.lib.awtextra.AbsoluteConstraints(420, 310, -1, -1));

        jLabel39.setFont(resourceMap.getFont("jLabel39.font")); // NOI18N
        jLabel39.setForeground(resourceMap.getColor("jLabel39.foreground")); // NOI18N
        jLabel39.setText(resourceMap.getString("jLabel39.text")); // NOI18N
        jLabel39.setName("jLabel39"); // NOI18N
        abInfo.add(jLabel39, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, -1, -1));

        tbDadosDoAssociado.addTab(resourceMap.getString("abInfo.TabConstraints.tabTitle"), abInfo); // NOI18N

        abHistorico.setBackground(resourceMap.getColor("abHistorico.background")); // NOI18N
        abHistorico.setName("abHistorico"); // NOI18N

        jScrollPane4.setName("jScrollPane4"); // NOI18N

        jTable3.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null}
            },
            new String [] {
                "Data", "Ação", "Usuário"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.Object.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTable3.setName("jTable3"); // NOI18N
        jScrollPane4.setViewportView(jTable3);
        jTable3.getColumnModel().getColumn(0).setHeaderValue(resourceMap.getString("jTable3.columnModel.title0")); // NOI18N
        jTable3.getColumnModel().getColumn(1).setHeaderValue(resourceMap.getString("jTable3.columnModel.title1")); // NOI18N
        jTable3.getColumnModel().getColumn(2).setHeaderValue(resourceMap.getString("jTable3.columnModel.title2")); // NOI18N

        jLabel42.setFont(resourceMap.getFont("jLabel42.font")); // NOI18N
        jLabel42.setForeground(resourceMap.getColor("jLabel42.foreground")); // NOI18N
        jLabel42.setText(resourceMap.getString("jLabel42.text")); // NOI18N
        jLabel42.setName("jLabel42"); // NOI18N

        javax.swing.GroupLayout abHistoricoLayout = new javax.swing.GroupLayout(abHistorico);
        abHistorico.setLayout(abHistoricoLayout);
        abHistoricoLayout.setHorizontalGroup(
            abHistoricoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(abHistoricoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(abHistoricoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 485, Short.MAX_VALUE)
                    .addComponent(jLabel42))
                .addContainerGap())
        );
        abHistoricoLayout.setVerticalGroup(
            abHistoricoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(abHistoricoLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel42)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 290, Short.MAX_VALUE)
                .addContainerGap())
        );

        tbDadosDoAssociado.addTab(resourceMap.getString("abHistorico.TabConstraints.tabTitle"), abHistorico); // NOI18N

        PainelPrincipal.add(tbDadosDoAssociado, new org.netbeans.lib.awtextra.AbsoluteConstraints(178, 11, 510, 388));

        pnEsquerdo.setName("pnEsquerdo"); // NOI18N
        pnEsquerdo.setOpaque(false);

        txtRol.setText(resourceMap.getString("txtRol.text")); // NOI18N
        txtRol.setBorder(javax.swing.BorderFactory.createTitledBorder(null, resourceMap.getString("txtRol.border.title"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, resourceMap.getFont("txtRol.border.titleFont"), resourceMap.getColor("txtRol.border.titleColor"))); // NOI18N
        txtRol.setName("txtRol"); // NOI18N
        txtRol.setOpaque(false);

        txtSituacao.setEditable(false);
        txtSituacao.setText(resourceMap.getString("txtSituacao.text")); // NOI18N
        txtSituacao.setBorder(javax.swing.BorderFactory.createTitledBorder(null, resourceMap.getString("txtSituacao.border.title"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, resourceMap.getFont("txtSituacao.border.titleFont"), resourceMap.getColor("txtSituacao.border.titleColor"))); // NOI18N
        txtSituacao.setName("txtSituacao"); // NOI18N
        txtSituacao.setOpaque(false);

        lblFoto.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblFoto.setText(resourceMap.getString("lblFoto.text")); // NOI18N
        lblFoto.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        lblFoto.setName("lblFoto"); // NOI18N

        txtDataFiliacao.setBorder(javax.swing.BorderFactory.createTitledBorder(null, resourceMap.getString("txtDataFiliacao.border.title"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, resourceMap.getFont("txtDataFiliacao.border.titleFont"), resourceMap.getColor("txtDataFiliacao.border.titleColor"))); // NOI18N
        try {
            txtDataFiliacao.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        txtDataFiliacao.setName("txtDataFiliacao"); // NOI18N
        txtDataFiliacao.setOpaque(false);
        txtDataFiliacao.setPreferredSize(new java.awt.Dimension(48, 50));

        txtLocFisica.setBorder(javax.swing.BorderFactory.createTitledBorder(null, resourceMap.getString("txtLocFisica.border.title"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, resourceMap.getFont("txtLocFisica.border.titleFont"), resourceMap.getColor("txtLocFisica.border.titleColor"))); // NOI18N
        try {
            txtLocFisica.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("'A##-G##'-P##.#")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        txtLocFisica.setName("txtLocFisica"); // NOI18N
        txtLocFisica.setOpaque(false);

        btnFoto.setText(resourceMap.getString("btnFoto.text")); // NOI18N
        btnFoto.setName("btnFoto"); // NOI18N
        btnFoto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnFotoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pnEsquerdoLayout = new javax.swing.GroupLayout(pnEsquerdo);
        pnEsquerdo.setLayout(pnEsquerdoLayout);
        pnEsquerdoLayout.setHorizontalGroup(
            pnEsquerdoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnEsquerdoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnEsquerdoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblFoto, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtLocFisica, javax.swing.GroupLayout.DEFAULT_SIZE, 160, Short.MAX_VALUE)
                    .addComponent(txtDataFiliacao, javax.swing.GroupLayout.DEFAULT_SIZE, 160, Short.MAX_VALUE)
                    .addComponent(txtSituacao, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 160, Short.MAX_VALUE)
                    .addComponent(txtRol, javax.swing.GroupLayout.DEFAULT_SIZE, 160, Short.MAX_VALUE)
                    .addComponent(btnFoto, javax.swing.GroupLayout.DEFAULT_SIZE, 160, Short.MAX_VALUE))
                .addContainerGap())
        );
        pnEsquerdoLayout.setVerticalGroup(
            pnEsquerdoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnEsquerdoLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblFoto, javax.swing.GroupLayout.PREFERRED_SIZE, 213, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btnFoto)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtRol, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtSituacao, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtDataFiliacao, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtLocFisica, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(5, 5, 5))
        );

        PainelPrincipal.add(pnEsquerdo, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 180, 470));

        bfInferior.setFloatable(false);
        bfInferior.setName("bfInferior"); // NOI18N
        bfInferior.setOpaque(false);

        btnSalvar.setForeground(resourceMap.getColor("btnSalvar.foreground")); // NOI18N
        btnSalvar.setIcon(resourceMap.getIcon("btnSalvar.icon")); // NOI18N
        btnSalvar.setText(resourceMap.getString("btnSalvar.text")); // NOI18N
        btnSalvar.setFocusable(false);
        btnSalvar.setName("btnSalvar"); // NOI18N
        btnSalvar.setOpaque(false);
        btnSalvar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSalvarActionPerformed(evt);
            }
        });
        bfInferior.add(btnSalvar);
        btnSalvar.getAccessibleContext().setAccessibleName(resourceMap.getString("jButton1.AccessibleContext.accessibleName")); // NOI18N

        btnEditar.setForeground(resourceMap.getColor("btnEditar.foreground")); // NOI18N
        btnEditar.setIcon(resourceMap.getIcon("btnEditar.icon")); // NOI18N
        btnEditar.setText(resourceMap.getString("btnEditar.text")); // NOI18N
        btnEditar.setFocusable(false);
        btnEditar.setName("btnEditar"); // NOI18N
        btnEditar.setOpaque(false);
        bfInferior.add(btnEditar);

        btnAtivaInativa.setForeground(resourceMap.getColor("btnAtivaInativa.foreground")); // NOI18N
        btnAtivaInativa.setIcon(resourceMap.getIcon("btnAtivaInativa.icon")); // NOI18N
        btnAtivaInativa.setText(resourceMap.getString("btnAtivaInativa.text")); // NOI18N
        btnAtivaInativa.setName("btnAtivaInativa"); // NOI18N
        btnAtivaInativa.setOpaque(false);
        btnAtivaInativa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAtivaInativaActionPerformed(evt);
            }
        });
        bfInferior.add(btnAtivaInativa);

        btnImprimir.setForeground(resourceMap.getColor("btnImprimir.foreground")); // NOI18N
        btnImprimir.setIcon(resourceMap.getIcon("btnImprimir.icon")); // NOI18N
        btnImprimir.setText(resourceMap.getString("btnImprimir.text")); // NOI18N
        btnImprimir.setFocusable(false);
        btnImprimir.setMaximumSize(new java.awt.Dimension(80, 33));
        btnImprimir.setMinimumSize(new java.awt.Dimension(80, 33));
        btnImprimir.setName("btnImprimir"); // NOI18N
        btnImprimir.setOpaque(false);
        btnImprimir.setPreferredSize(new java.awt.Dimension(67, 33));
        btnImprimir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnImprimirActionPerformed(evt);
            }
        });
        bfInferior.add(btnImprimir);

        PainelPrincipal.add(bfInferior, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 410, 490, 50));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(PainelPrincipal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(PainelPrincipal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalvarActionPerformed
        salvarAssociado();
    }//GEN-LAST:event_btnSalvarActionPerformed

    private void btnExcluirObsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExcluirObsActionPerformed
        ExcluirObservacao();
}//GEN-LAST:event_btnExcluirObsActionPerformed

    private void btnEditarObsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEditarObsActionPerformed
        txtObservacao.setEditable(true);
        txtObservacao.setBackground(Color.white);
        btnAdicionarObs.setText("Alterar");
}//GEN-LAST:event_btnEditarObsActionPerformed

    private void tabelaObservacaoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tabelaObservacaoMouseClicked
        selecionarObservacao();
}//GEN-LAST:event_tabelaObservacaoMouseClicked

    private void btnContratarConvenioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnContratarConvenioActionPerformed
        chamarAdesaoConvenio();
}//GEN-LAST:event_btnContratarConvenioActionPerformed

    private void comboUFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboUFActionPerformed
        try {
            configurarComboCidade();
        } catch (SQLException ex) {
            Logger.getLogger(TelaAssociadoEdt.class.getName()).log(Level.SEVERE, null, ex);
        }        // TODO add your handling code here:
}//GEN-LAST:event_comboUFActionPerformed

    private void btnNovoDependenteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNovoDependenteActionPerformed
        chamarTelaDependente();
    }//GEN-LAST:event_btnNovoDependenteActionPerformed

    private void btnAdicionarObsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAdicionarObsActionPerformed
        AcoesBtnAdicionarObservacao();
    }//GEN-LAST:event_btnAdicionarObsActionPerformed

    private void btnImprimirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnImprimirActionPerformed
        imprimir();
    }//GEN-LAST:event_btnImprimirActionPerformed

    private void btnFotoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFotoActionPerformed
        procurarFoto();
    }//GEN-LAST:event_btnFotoActionPerformed

    private void tabelaDependentesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tabelaDependentesMouseClicked
        if (evt.getClickCount() >= 2) {
            try {
                abrirDependente();
            } catch (SQLException ex) {
                Logger.getLogger(TelaAssociadoEdt.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_tabelaDependentesMouseClicked

    private void btnAtivaInativaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAtivaInativaActionPerformed
        ativaInativa();
    }//GEN-LAST:event_btnAtivaInativaActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel PainelPrincipal;
    public javax.swing.JTable TabelaConveniosContratados;
    private javax.swing.JPanel abConvenios;
    private javax.swing.JPanel abDadosPessoais;
    private javax.swing.JPanel abDependentes;
    private javax.swing.JPanel abEnderecoContatos;
    private javax.swing.JPanel abHistorico;
    private javax.swing.JPanel abInfo;
    private javax.swing.JPanel abProtocolo;
    private javax.swing.JPanel abaVinculo;
    private javax.swing.JToolBar bfDependentenIferior1;
    private javax.swing.JToolBar bfInferior;
    private javax.swing.JButton btnAdicionarObs;
    private javax.swing.JButton btnAtivaInativa;
    private javax.swing.JButton btnContratarConvenio;
    private javax.swing.JButton btnEditar;
    private javax.swing.JButton btnEditarObs;
    private javax.swing.JButton btnExcluirObs;
    private javax.swing.JButton btnFoto;
    private javax.swing.JButton btnImprimir;
    private javax.swing.JButton btnNovoDependente;
    private javax.swing.JButton btnSalvar;
    private javax.swing.JComboBox comboCargoComissionado;
    private javax.swing.JComboBox comboCategoriaVinculo;
    private javax.swing.JComboBox comboCidade;
    private javax.swing.JComboBox comboConvenios;
    private javax.swing.JComboBox comboSecretaria;
    private javax.swing.JComboBox comboSexo;
    private javax.swing.JComboBox comboUF;
    private javax.swing.JButton jButton5;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel35;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel37;
    private javax.swing.JLabel jLabel38;
    private javax.swing.JLabel jLabel39;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel40;
    private javax.swing.JLabel jLabel41;
    private javax.swing.JLabel jLabel42;
    private javax.swing.JLabel jLabel43;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JTable jTable3;
    private javax.swing.JTable jTable4;
    private javax.swing.JLabel lblFoto;
    private javax.swing.JPanel painelContatos;
    private javax.swing.JPanel painelEndereco;
    private javax.swing.JPanel pnEsquerdo;
    private javax.swing.JScrollPane scrollConveniosContratados;
    private javax.swing.JTable tabelaDependentes;
    private javax.swing.JTable tabelaObservacao;
    private javax.swing.JTabbedPane tbDadosDoAssociado;
    private javax.swing.JTextField txtBairro;
    private javax.swing.JTextField txtCargo;
    private javax.swing.JFormattedTextField txtCelular1;
    private javax.swing.JFormattedTextField txtCelular2;
    private javax.swing.JFormattedTextField txtCep;
    private javax.swing.JTextField txtComplemento;
    private javax.swing.JFormattedTextField txtCpf;
    private javax.swing.JFormattedTextField txtDataAdmissao;
    private javax.swing.JFormattedTextField txtDataFiliacao;
    private javax.swing.JTextField txtEmail;
    private javax.swing.JTextField txtFuncao;
    private javax.swing.JTextField txtIdentidade;
    private javax.swing.JFormattedTextField txtLocFisica;
    private javax.swing.JTextField txtLogradouro;
    private javax.swing.JTextField txtLotacao;
    private javax.swing.JTextField txtMatricula;
    private javax.swing.JTextField txtNacionalidade;
    private javax.swing.JFormattedTextField txtNascimento;
    private javax.swing.JTextField txtNaturalidade;
    private javax.swing.JTextField txtNome;
    private javax.swing.JTextField txtNomeMae;
    private javax.swing.JTextField txtNomePai;
    private javax.swing.JTextField txtNumero;
    private javax.swing.JTextArea txtObservacao;
    private javax.swing.JTextField txtOrgaoExepedidor;
    private javax.swing.JTextField txtRol;
    private javax.swing.JTextField txtSecao;
    private javax.swing.JTextField txtSituacao;
    private javax.swing.JFormattedTextField txtTelefone1;
    private javax.swing.JFormattedTextField txtTelefone2;
    private javax.swing.JTextField txtTitulo;
    private javax.swing.JTextField txtZona;
    // End of variables declaration//GEN-END:variables
}
